package com.ibeetl.admin.api.service;

import com.ibeetl.admin.api.dao.TravelPictureDao;
import com.ibeetl.admin.api.entity.TravelPictureList;
import com.ibeetl.admin.core.service.CoreBaseService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;

@Service
@Transactional
public class TravelPictureService extends CoreBaseService<TravelPictureList> {
    @Resource
    private TravelPictureDao travelPictureDao;

    public List<TravelPictureList> queryByAttractionId(long attraction_id,long user_id) {

        return travelPictureDao.queryByAttractionId( attraction_id,user_id);

    }

    public Long queryNewIdByAttractionId(long attraction_id,long user_id) {
        List<Long> list = travelPictureDao.queryNewIdByAttractionId(attraction_id,user_id);
        if(list == null || list.size()<1) return null;
        return list.get(0);
    }


    public List<TravelPictureList> queryByAttsId(long atts_id,long user_id) {

        return travelPictureDao.queryByAttsId( atts_id,user_id);

    }

    public void delete(Long pictureId,int state) {

        travelPictureDao.updateState( pictureId,state);

    }
}
